<?php
/*
Plugin Name: wp fields
Plugin URI: http://decodize.com
Description: Inspired from simple-field wp plugin. You can create group of fields and can be added to pages/posts.
Version: 0.4
Author: Praveen vijayan
Author URI: http://decodize.com
License: GPL2
Email :praveenv.vijayan@gmail.com
*/
define( "WP_FIELDS_URL", WP_PLUGIN_URL . '/wp-fields/');
define( "WP_FIELDS_NAME", "Wp Fields"); 
define( "WP_FIELDS_VERSION", "0.1");

// Load script & css
add_action( 'admin_init', 'wp_fields_admin_init' );
add_action( 'admin_menu', "wp_fields_admin_menu" );
//add_action( 'admin_head', 'wp_fields_admin_head' );

// ajax call for adding fields
add_action('wp_ajax_wp_fields_field_group_add_field', 'wp_fields_field_group_add_field');

function wp_fields_admin_init() {

	wp_enqueue_script("jquery");
	/*wp_enqueue_script("jquery-ui-core");
	wp_enqueue_script("jquery-ui-sortable");
	wp_enqueue_script("jquery-ui-effects-core", EASY_FIELDS_URL . "jquery.effects.core.js");
	wp_enqueue_script("jquery-ui-effects-highlight", EASY_FIELDS_URL . "jquery.effects.highlight.js");
	wp_enqueue_script("thickbox");
	wp_enqueue_style("thickbox");*/
	wp_enqueue_script("jquery-ui", WP_FIELDS_URL . "jquery-ui.js");
	wp_enqueue_style('jquery-ui-css', WP_FIELDS_URL.'jquery-ui.css', false, WP_FIELDS_VERSION);
	wp_enqueue_script("jscolor", WP_FIELDS_URL . "jscolor/jscolor.js"); // color picker for type color
	wp_enqueue_script("date", WP_FIELDS_URL . "datepicker/date.js"); // date picker for type date
	wp_enqueue_script("jquery-datepicker", WP_FIELDS_URL . "datepicker/jquery.datePicker.js"); // date picker for type date
	wp_enqueue_style('jquery-datepicker', WP_FIELDS_URL.'datepicker/datePicker.css', false, WP_FIELDS_VERSION);

	// add css and scripts
	wp_enqueue_style('wp-fields-styles', WP_FIELDS_URL.'style.css', false, WP_FIELDS_VERSION);
	wp_register_script('wp-fields-scripts', WP_FIELDS_URL.'script.js', false, WP_FIELDS_VERSION);
	/*wp_localize_script('simple-fields-scripts', 'sfstrings', array(
		'txtDelete' => __('Delete', 'simple-fields'),
		'confirmDelete' => __('Delete this field?', 'simple-fields'),
		'confirmDeleteGroup' => __('Delete this group?', 'simple-fields'),
		'confirmDeleteConnector' => __('Delete this post connector?', 'simple-fields'),
		'confirmDeleteRadio' => __('Delete radio button?', 'simple-fields'),
		'confirmDeleteDropdown' => __('Delete dropdown value?', 'simple-fields'),
		'adding' => __('Adding...', 'simple-fields'),
		'add' => __('Add', 'simple-fields'),
		'confirmRemoveGroupConnector' => __('Remove field group from post connector?', 'simple-fields'),
		'confirmRemoveGroup' => __('Remove this field group?', 'simple-fields'),
		'context' => __('Context', 'simple-fields'),
		'normal' => __('normal'),
		'advanced' => __('advanced'),
		'side' => __('side'),
		'low' => __('low'),
		'high' => __('high'),
	));*/
	wp_enqueue_script('wp-fields-scripts');

	define( "WP_FIELDS_FILE", menu_page_url("wp-fields-options", false) );

}

require("functions_admin.php");
//require("functions_post.php");